﻿using System;
using System.IO;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Drawing;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Vml;
using DocumentFormat.OpenXml.Wordprocessing;
namespace TestOffice
{
    public static class TestWord_3
    {
        public static DocumentFormat.OpenXml.Vml.Shape CreateShape()
        {
            // 创建一个Shape节点
            // 创建一个形状并设置其属性
            string pathstyle = "font-family:宋体;font-size:36pt;v-text-align:center;";
            DocumentFormat.OpenXml.Vml.Shape shape = new DocumentFormat.OpenXml.Vml.Shape(
               // new DocumentFormat.OpenXml.Drawing.Extents() { Cx = 914400L, Cy = 165100L },
                new DocumentFormat.OpenXml.Vml.Stroke() { On=false},
                new DocumentFormat.OpenXml.Vml.Path(),
                new DocumentFormat.OpenXml.Vml.Fill() {On=true,Opacity= "32768f",FocusSize= "0,0" },
                new ImageData() { },
                new DocumentFormat.OpenXml.Vml.Office.Lock() {Extension= ExtensionHandlingBehaviorValues.Edit,Grouping=false,Rotation=false,TextLock=false, AspectRatio=true},
                new DocumentFormat.OpenXml.Vml.TextPath() {On=true,FitShape=true,FitPath=true,Trim=true,XScale=false,String="测试水印",Style= pathstyle }

                );
            shape.Adjustment = "10800";
            shape.FillColor = "#C0C0C0";
            shape.Filled = true;
            shape.Stroked = false;
            shape.CoordinateSize = "21600,21600";
            shape.OptionalString = "_x0000_s4098";
            shape.OptionalNumber = 136;
            string style = "position:absolute;left:0pt;height:130.25pt;width:456.95pt;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin;rotation:20643840f;z-index:-251657216;mso-width-relative:page;mso-height-relative:page;";
            shape.Style= style;






            return shape;


            
        }
    }
}
